#include<iostream>
template<typename T>
class unique_ptr {
public:
	unique_ptr(T* data):data_(data){}
	unique_ptr(unique_ptr&& up)noexcept :data_(up.data_){
		up.data_ = nullptr;
	}
	unique_ptr& operator=(unique_ptr&& up) {
		if (up.data_ == data_) return *this;
		deconstruct();
		data_ = up.data_;
		up.data_ = nullptr;
		return *this;
	}

	~unique_ptr() {
		deconstruct();
	}

private:
	unique_ptr(unique_ptr&) = delete;
	unique_ptr& operator=(unique_ptr&) = delete;

	void deconstruct() {
		if (data_ != nullptr) {
			delete data_;
			data_ = nullptr;
		}
	}

	T* data_;
};

class Test {
public:
	Test() {
		std::cout << "Test()" << std::endl;
	}
	~Test() {
		std::cout << "~Test()" << std::endl;
	}
};
int main() {
	{
		unique_ptr<Test>ptest1(new Test());
		unique_ptr<Test>ptest2(new Test());
		ptest1 = std::move(ptest2);
	}
	int i;
	std::cin >> i;
}
